<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\HasUniqueSlug;

class Category extends Model
{
    use HasFactory , HasUniqueSlug;

    protected $fillable = ['name','slug','description',];

    /**
     * 定义分类与文章之间的一对多关系（拥有多篇文章）
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function articles()
    {
        return $this->hasMany(Article::class);
    }
}
